import axios from 'axios'
import store from './../store'
const service = axios.create({
  baseURL: '/api', // api 的 base_urlhttp://edu_test_api.zhiyunzaixian.com/
  timeout: 10000 // request timeout
})
service.interceptors.request.use(
  config => {
    if (config.url === '/information/shopshop/personupload') {
      return config
    }
    if (config.url === `/information/shopshop/upload`) {
      return config
    }
    if (config.data instanceof Object || config.data === undefined) {
      let addData = {
        app_id: store.state.app_id
      }
      config.data = {...config.data, ...addData}
    }
    return config
  },
  error => {
    // Do something with request error
    // console.log(error) // for debug
    Promise.reject(error)
  }
)
export default service
